package com.gmail.jaredjeya.awesomeplatformer.view;

import com.gmail.jaredjeya.awesomeplatformer.R;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;
import android.widget.Toast;

public class Dialogs {
	
	public static void options(Context c) {
		Toast.makeText(c, "NYI", Toast.LENGTH_SHORT).show();
	}
	
	public static void help(final Context c, final int message) {
		AlertDialog.Builder alert = new AlertDialog.Builder(c);
		alert.setCancelable(true);
		switch(message) {
			case 0:
				alert.setTitle("Basics");
				alert.setMessage(R.string.help_message1);
				break;
			case 1:
				alert.setTitle("Controls");
				alert.setMessage(R.string.help_message2);
				break;
			case 2:
				alert.setTitle("Surfaces");
				alert.setMessage(R.string.help_message3);
				break;
			case 3:
				alert.setTitle("Enemies");
				alert.setMessage(R.string.help_message4);
				break;
			default:
				return;
		}
		
		alert.setNeutralButton("Next", new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
				help(c, message + 1);
			}
		});
		
		alert.create().show();
	}
	
	public static void about(Context c) {
		AlertDialog.Builder alert = new AlertDialog.Builder(c);
		alert.setTitle("About this game");
		alert.setMessage(R.string.about_message);
		alert.setCancelable(true);
		AlertDialog dialog = alert.create();
		dialog.show();
		((TextView) dialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
	}

}
